<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Password Toggle</title>
    <style>
        form {
            width: 300px;
            margin: 0 auto;
            padding-top: 50px;
        }

        input[type="password"],
        img {
            vertical-align: middle;
        }
    </style>
</head>

<body>
    <form>
        <input type="password" id="passwordInput" placeholder="请输入密码">
        <img id="eyeIcon" src="bi.png" alt="闭眼" style="cursor: pointer;">
    </form>
</body>
<script>
    const passwordInput = document.getElementById('passwordInput');
    const eyeIcon = document.getElementById('eyeIcon');

    eyeIcon.addEventListener('click', function () {
        if (passwordInput.type === 'password') {
            passwordInput.type = 'text';
            eyeIcon.src = 'zheng.png'; 
        } else {
            passwordInput.type = 'password';
            eyeIcon.src = 'closed_eye.png';
        }
    });
</script>
</html>